//登录
import login from "../components/login";

import redirect from "../components/redirect";

//首页
import homePage from "../components/homePage/homePage";


let baseRoutes = [
  { path: '/login', component: login }, //登录
  { path: '/redirect', component: redirect }, //重定向
  // {path:'/bindAccount',component: bindAccount}, //微信登录
  { path: '/', component: redirect }, //首页
];


import test from "../components/data/test";
import storeData from "../components/data/storeData";
import shopList from "../components/data/shopList";
import shopDetail from "../components/data/shopDetail";
import userList from "../components/data/userList";
import orderList from "../components/data/orderList";
import profitList from "../components/data/profitList";
import finance from "../components/data/finance";
import monthPay from "../components/data/monthPay";
import openShop from "../components/data/openShop";
import article from "../components/data/article";
import articleDetail from "../components/data/articleDetail";
let dataRoutes = [
  { path: '/data/test', name: 'test', component: test, meta: { title: '测试' } },
  { path: '/data/storeData', name: 'storeData', component: storeData, meta: { title: '商家数据' } },
  { path: '/data/shopList', name: 'shopList', component: shopList, meta: { title: '商家列表' } },
  { path: '/data/shopDetail/:id', name: 'shopDetail', component: shopDetail, meta: { title: '商家详情' } },
  { path: '/data/userList', name: 'userList', component: userList, meta: { title: '会员列表' } },
  { path: '/data/orderList', name: 'orderList', component: orderList, meta: { title: '消费列表' } }, //消费列表
  { path: '/data/profitList', name: 'profitList', component: profitList, meta: { title: '运营账户' } }, //消费列表
  { path: '/data/finance', name: 'finance', component: finance, meta: { title: '财务账户' } },
  { path: '/data/monthPay', name: 'monthPay', component: monthPay, meta: { title: '上月支出' } }, //
  { path: '/data/openShop', name: 'openShop', component: openShop, meta: { title: '开店审核' } }, //
  { path: '/data/article', name: 'article', component: article, meta: { title: '文章列表' } }, //
  { path: '/data/articleDetail/:id', name: 'articleDetail', component: articleDetail, meta: { title: '文章详情' } }, //
];

import nav from "../components/system/nav"
import cate from "../components/system/cate"
import banner from "../components/system/banner"
import msg from "../components/system/msg"
import vip from "../components/system/vip"
import code from "../components/system/code"
import plan from "../components/system/plan"
import vipRight from "../components/system/vipRight"
import hot from "../components/system/hot"

let systemRoutes = [
  { path: '/system/nav', name: 'nav', component: nav, meta: { title: '导航列表' } },
  { path: '/system/cate', name: 'cate', component: cate, meta: { title: '分类列表' } },
  { path: '/system/banner', name: 'banner', component: banner, meta: { title: '广告列表' } },
  { path: '/system/msg', name: 'msg', component: msg, meta: { title: '信息列表' } },
  { path: '/system/vipRight', name: 'vipRight', component: vipRight, meta: { title: '会员权益' } },
  { path: '/system/hot', name: 'hot', component: hot, meta: { title: '热门搜索' } },
  { path: '/system/vip', name: 'vip', component: vip, meta: { title: '会费设置列表' } },
  { path: '/system/code', name: 'code', component: code, meta: { title: '邀请码列表' } },
  { path: '/system/plan', name: 'plan', component: plan, meta: { title: '分账计划列表' } },
]


import verifyCash from "../components/verify/cash";
let verifyRoutes = [
  { path: '/verify/shop', name: 'verifyShop', component: shopList, meta: { title: '商家审核' } },
  { path: '/verify/cash', name: 'verifyCash', component: verifyCash, meta: { title: '提现审核' } },
];

import account from "../components/group/account";

let accountRoutes = [
  { path: '/account/index', name: 'account', component: account },
];

import area from "../components/area/index";
let areaRoutes = [
  { path: '/area/index', name: 'area', component: area },
];


import order from "../components/order/index";
import orderVip from "../components/order/vip";
let orderRoutes = [
  { path: '/order/index', name: 'order', component: order ,meta: { title: '消费列表' }},
  { path: '/order/vip', name: 'orderVip', component: orderVip ,meta: { title: '会员开卡列表' }},
];

import shopIndex from "../components/shop/index";
import shopGood from "../components/shop/good";
import shopContent from "../components/shop/content";
import shopActivity from "../components/shop/activity";
let shopRoutes = [
  { path: '/shop/index', name: 'shopIndex', component: shopIndex,meta: { title: '商户信息' } },
  { path: '/shop/good', name: 'shopGood', component: shopGood,meta: { title: '特色产品' } },
  { path: '/shop/content', name: 'shopContent', component: shopContent,meta: { title: '店铺简介' } },
  { path: '/shop/activity', name: 'shopActivity', component: shopActivity,meta: { title: '活动列表' } },
];


// let routes = baseRoutes.concat(dataRoutes).concat(verifyRoutes).concat(accountRoutes).concat(areaRoutes).concat(shopRoutes)
let routes = [...baseRoutes,...dataRoutes,...verifyRoutes,...accountRoutes,...areaRoutes,...orderRoutes,...shopRoutes,...systemRoutes]

export default {
  routes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      if (from.meta.keepAlive) {
        from.meta.savedPosition = document.body.scrollTop
      }
      return { x: 0, y: to.meta.savedPosition || 0 }
    }
  }
};
